package com.hao.wms.mvc;

import com.hao.wms.domain.ProductStock;
import com.hao.wms.query.ProductStockQueryObject;
import com.hao.wms.service.IProductStockService;
import com.hao.wms.util.RequiredPermission;
import com.opensymphony.xwork2.interceptor.annotations.InputConfig;

import java.io.IOException;

public class ProductStockAction extends BaseAction{
	/**
	 * 
	 */
	private IProductStockService productStockService;
	
	
	private ProductStockQueryObject queryObject = new ProductStockQueryObject();
	
	
	public ProductStockQueryObject getQueryObject() {
		return queryObject;
	}
	public void setQueryObject(ProductStockQueryObject queryObject) {
		this.queryObject = queryObject;
	}
	public void setProductStockService(IProductStockService productStockService) {
		this.productStockService = productStockService;
	}
	@InputConfig(methodName = "input")
	@RequiredPermission(value="库存列表查询")
	public String execute() {
		putContext(PAGERESULT, productStockService.query(queryObject));
		
		return LIST;
	}
	/*@RequiredPermission(value="新增/修改ProductStock")
	public String input() {
		if(productStock.getId()!=null) {
			productStock = productStockService.get(productStock.getId());
		}
		return INPUT;
	}
	@RequiredPermission(value="修改ProductStock")
	public String saveOrUpdate() {
		try {
			if(productStock.getId()!=null) {
                productStockService.update(productStock);
                addActionMessage("修改成功");
            }else {
                productStockService.save(productStock);
                addActionMessage("保存成功");
            }
		} catch (Exception e) {
			e.printStackTrace();
			addActionError(e.getMessage());
		}
		return SUCCESS;
	}
	public void prepareSaveOrUpdate(){
		if(productStock.getId()!=null) {
			productStock = productStockService.get(productStock.getId());
			
		}
	}
	@RequiredPermission(value="删除ProductStock")
	public String delete() throws IOException{
		productStockService.delete(productStock);
		putResponseText("删除成功");
		return NONE;
	}*/
	
	

}
